import mixin from './mixin/index.js'
import utils from "./utils/index";
import test from './utils/test.js'
// 防抖方法
import debounce from './utils/debounce.js'
// 节流方法
import throttle from './utils/throttle.js'
import htmlParser from './utils/htmlParser.js'
import toFriendlyTime from './utils/toFriendlyTime.js'
import Im from './sdk/index.js'
import router from './sdk/router/Router.js'
uni.$u = {
	...utils,
	...htmlParser,
	test,
	debounce,
	throttle,
	toFriendlyTime
}

uni.$Im = Im;

const install = (Vue) => {
	Vue.mixin(mixin)
	// 同时挂载到uni和Vue.prototype中
	// #ifndef APP-NVUE
	// 只有vue，挂载到Vue.prototype才有意义，因为nvue中全局Vue.prototype和Vue.mixin是无效的
	if (Vue.config.globalProperties) {
		Vue.config.globalProperties.$u = uni.$u
		Vue.config.globalProperties.$Im = Im
	}else{
		Vue.prototype.$u = uni.$u
		Vue.prototype.$Im = Im
	}
	// #endif
}

export default {
	install
}